import java.sql.*;

public class Demo4 {
    public static void main(String[] args) {
        Connection conn = null;
        try {
            Class.forName("org.postgresql.Driver");
            conn = DriverManager.getConnection("jdbc:postgresql://172.16.55.185:5001/vastbase?", "zxs", "Vastdata#0730");
            Statement statement = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
            ResultSet rs = statement.executeQuery("select id,name from t_user");
            rs.next();
            rs.updateString("name", "Accounting");
            rs.updateRow();


//            PreparedStatement psmt = conn.prepareStatement("select id,name from t_user", ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
//            psmt.setInt(1, 1);
//            ResultSet rs = psmt.executeQuery();
//            while (rs.next()) {
//                System.out.println(rs.getString(2));
//                rs.refreshRow();
//                System.out.println(rs.getString(2));
//            }

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (conn != null) {
                try {
                    conn.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }

        }
    }

}
